<%--
  Created by IntelliJ IDEA.
  User: Christopher
  Date: 2022/5/10
  Time: 12:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <link href="${pageContext.request.contextPath}/images/favicon.ico" rel="shortcut icon" >
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>大帅银行 | 添加客户</title>

    <!-- Bootstrap -->
    <link href="${pageContext.request.contextPath}/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="${pageContext.request.contextPath}/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="${pageContext.request.contextPath}/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="${pageContext.request.contextPath}/vendors/iCheck/skins/flat/green.css" rel="stylesheet">
    <!-- bootstrap-progressbar -->
    <link href="${pageContext.request.contextPath}/vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="${pageContext.request.contextPath}/vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet"/>

    <!-- Custom Theme Style -->
    <link href="${pageContext.request.contextPath}/build/css/custom.min.css" rel="stylesheet">
</head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">
        <div class="col-md-3 left_col">
            <div class="left_col scroll-view">
                <div class="navbar nav_title" style="border: 0;">
                    <a href="${pageContext.request.contextPath}/" class="site_title"><i class="fa fa-paw"></i> <span>大帅银行

                    </span></a>
                </div>

                <div class="clearfix"></div>

                <!-- menu profile quick info -->
                <div class="profile">
                    <div class="profile_pic">
                        <img src="${pageContext.request.contextPath}/images/img.jpg" alt="..." class="img-circle profile_img">
                    </div>
                    <div class="profile_info">
                        <span>Welcome,</span>
                        <h2><security:authentication property="principal.empName"></security:authentication></h2>
                    </div>
                </div>
                <!-- /menu profile quick info -->

                <br />

                <!-- sidebar menu -->
                <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
                    <div class="menu_section">
                        <h3>&nbsp;</h3>
                        <ul class="nav side-menu">
                            <li><a><i class="fa fa-home"></i> 员工管理 <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="${pageContext.request.contextPath}/emp/show_emp">查看员工</a></li>
                                    <li><a href="${pageContext.request.contextPath}/emp/add_emp">添加员工</a></li>
                                </ul>
                            </li>
                            <li><a><i class="fa fa-edit"></i> 贷款客户管理 <span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="${pageContext.request.contextPath}/customer/show_all_custom">查看全部客户</a></li>
                                    <li><a href="${pageContext.request.contextPath}/customer/add_custom">添加客户</a></li>
                                    <li><a href="${pageContext.request.contextPath}}/customer/review_custom">客户信息审核</a></li>
                                    <li><a href="${pageContext.request.contextPath}}/customer/found_contract">生成贷款合同</a></li>
                                </ul>
                            </li>
                            <li><a><i class="fa fa-desktop"></i>贷款产品管理<span class="fa fa-chevron-down"></span></a>
                                <ul class="nav child_menu">
                                    <li><a href="${pageContext.request.contextPath}/product/show_all_produce">查看全部产品</a></li>
                                    <li><a href="${pageContext.request.contextPath}/product/add_loan_produce">添加贷款产品</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>

                </div>
                <!-- /sidebar menu -->

                <!-- /menu footer buttons -->
                <div class="sidebar-footer hidden-small">
                    <a data-toggle="tooltip" data-placement="top" title="Settings">
                        <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
                    </a>
                    <a data-toggle="tooltip" data-placement="top" title="FullScreen">
                        <span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
                    </a>
                    <a data-toggle="tooltip" data-placement="top" title="Lock">
                        <span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>
                    </a>
                    <a data-toggle="tooltip" data-placement="top" title="Logout">
                        <span class="glyphicon glyphicon-off" aria-hidden="true"></span>
                    </a>
                </div>
                <!-- /menu footer buttons -->
            </div>
        </div>

        <!-- top navigation -->
        <div class="top_nav">
            <div class="nav_menu">
                <nav>
                    <div class="nav toggle">
                        <a id="menu_toggle"><i class="fa fa-bars"></i></a>
                    </div>

                    <ul class="nav navbar-nav navbar-right">
                        <li class="">
                            <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                <img src="${pageContext.request.contextPath}/images/img.jpg" alt="">
                                <security:authentication property="principal.empName"></security:authentication>
                                <span class=" fa fa-angle-down"></span>
                            </a>
                            <ul class="dropdown-menu dropdown-usermenu pull-right">
                                <li><a href="${pageContext.request.contextPath}/emp/show_my_info"> 看看信息</a></li>
                                <li>
                                    <a href="${pageContext.request.contextPath}/emp/change_my_password">
                                        <span>修改密码</span>
                                    </a>
                                </li>
                                <li><a href="${pageContext.request.contextPath}/logout"><i class="fa fa-sign-out pull-right"></i>注销</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
        <!-- /top navigation -->

        <!-- page content -->
        <div class="right_col" role="main">

            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>客户管理 <small>添加客户</small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="row"><h3 class="col-md-2 col-md-offset-5">添加客户信息</h3></div>

                        <br />
                        <form action="${pageContext.request.contextPath}/customer/do_add_customer" method="post" id="add_emp_form" data-parsley-validate class="form-horizontal form-label-left" enctype="multipart/form-data">

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="customer_name">姓名 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="text" id="customer_name" name="customerName" required="required" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="tel_no">电话 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="text" id="tel_no" name="telNo" required="required" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="idTypeId">证件类型 <span class="required">*</span>
                                </label>
                                <div  class="col-md-4 col-sm-4 col-xs-12">
                                    <select name="idTypeId" id="idTypeId" class="form-control" required>
                                        <c:forEach items="${certificates}" var="c">
                                            <option value="${c.ctId}">${c.ctName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="id_no">证件号码 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="text" id="id_no" name="idNo" required="required" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="ad_img">身份证正面 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="file" id="ad_img" name="upload" required="required" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="p">所在省份 <span class="required">*</span>
                                </label>
                                <div  class="col-md-4 col-sm-4 col-xs-12">
                                    <select name="pId" id="p" class="form-control" required>
                                        <option value="">----请选择----</option>
                                        <c:forEach items="${provinces}" var="p">
                                            <option value="${p.id}">${p.name}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="p">所在城市 <span class="required">*</span>
                                </label>
                                <div  class="col-md-4 col-sm-4 col-xs-12">
                                    <select name="cId" id="c" class="form-control" required>
                                        <option value="">----请选择----</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="p">市/区/县 <span class="required">*</span>
                                </label>
                                <div  class="col-md-4 col-sm-4 col-xs-12">
                                    <select name="tId" id="d" class="form-control" required>
                                            <option value="">----请选择----</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="home_address">家庭住址 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="text" id="home_address" name="homeAddress" required="required"  class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="co_name">公司名称 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="text" id="co_name" name="coName" required="required"  class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1" for="co_address">公司地址 <span class="required">*</span>
                                </label>
                                <div class="col-md-4 col-sm-4 col-xs-12 ">
                                    <input type="tel" id="co_address" name="coAddress" required="required"  class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>


                            <div class="ln_solid"></div>
                            <div class="form-group">
                                <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
                                    <button type="submit" class="btn btn-success">提交</button>
                                    <button type="reset" class="btn btn-primary">取消</button>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>


        </div>
        <!-- /page content -->

        <!-- footer content -->
        <footer>
            <div class="pull-right">
                大帅银行 - 令人信赖的金融助手 <a href="https://www.dsbank.com">大帅银行</a>
            </div>
            <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
    </div>
</div>

<!-- jQuery -->
<script src="${pageContext.request.contextPath}/vendors/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="${pageContext.request.contextPath}/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="${pageContext.request.contextPath}/vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="${pageContext.request.contextPath}/vendors/nprogress/nprogress.js"></script>
<!-- Chart.js -->
<script src="${pageContext.request.contextPath}/vendors/Chart.js/dist/Chart.min.js"></script>
<!-- gauge.js -->
<script src="${pageContext.request.contextPath}/vendors/gauge.js/dist/gauge.min.js"></script>
<!-- bootstrap-progressbar -->
<script src="${pageContext.request.contextPath}/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
<!-- iCheck -->
<script src="${pageContext.request.contextPath}/vendors/iCheck/icheck.min.js"></script>
<!-- Skycons -->
<script src="${pageContext.request.contextPath}/vendors/skycons/skycons.js"></script>
<!-- Flot -->
<script src="${pageContext.request.contextPath}/vendors/Flot/jquery.flot.js"></script>
<script src="${pageContext.request.contextPath}/vendors/Flot/jquery.flot.pie.js"></script>
<script src="${pageContext.request.contextPath}/vendors/Flot/jquery.flot.time.js"></script>
<script src="${pageContext.request.contextPath}/vendors/Flot/jquery.flot.stack.js"></script>
<script src="${pageContext.request.contextPath}/vendors/Flot/jquery.flot.resize.js"></script>
<!-- Flot plugins -->
<script src="${pageContext.request.contextPath}/vendors/flot.orderbars/js/jquery.flot.orderBars.js"></script>
<script src="${pageContext.request.contextPath}/vendors/flot-spline/js/jquery.flot.spline.min.js"></script>
<script src="${pageContext.request.contextPath}/vendors/flot.curvedlines/curvedLines.js"></script>
<!-- DateJS -->
<script src="${pageContext.request.contextPath}/vendors/DateJS/build/date.js"></script>
<!-- JQVMap -->
<script src="${pageContext.request.contextPath}/vendors/jqvmap/dist/jquery.vmap.js"></script>
<script src="${pageContext.request.contextPath}/vendors/jqvmap/dist/maps/jquery.vmap.world.js"></script>
<script src="${pageContext.request.contextPath}/vendors/jqvmap/examples/js/jquery.vmap.sampledata.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="${pageContext.request.contextPath}/js/moment/moment.min.js"></script>
<script src="${pageContext.request.contextPath}/js/datepicker/daterangepicker.js"></script>

<!--省市县三级联动-->
<script>
    $("#p").change(function (){

        console.log(this)

        $.ajax({

            url:"${pageContext.request.contextPath}/city_district/show_city_or_district/"+$(this).val(),
            dataType:"json",
            success:function (data){
                if(data.code == 0){
                    $("#c").html("<option value=''>----请选择----</option>");
                    $(data.obj).each(function (i,e){
                        let city = "<option value = "+e.id+">"+e.name+"</option>";
                        $("#c").append(city);
                    })
                }
            }
        })
    })

    $("#c").change(function (){

        console.log(this)

        $.ajax({

            url:"${pageContext.request.contextPath}/city_district/show_city_or_district/"+$(this).val(),
            dataType:"json",
            success:function (data){
                if(data.code == 0){
                    $("#d").html("<option value=''>----请选择----</option>");
                    $(data.obj).each(function (i,e){
                        let town = "<option value = "+e.id+">"+e.name+"</option>";
                        $("#d").append(town);
                    })
                }
            }
        })
    })

</script>
